package com.lh.controller;

import com.lh.service.AsyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 线程并发Controller测试类
 *
 * @Author LuoHang
 * @Date 2022-05-08 22:06
 **/
@Controller
public class AsyncController {
    public static final Logger logger = LoggerFactory.getLogger(AsyncController.class);
    @Autowired
    private AsyncService asyncService;

    @GetMapping("/async")
    public @ResponseBody String async(){
        logger.info("AsyncController 获取异步请求");

        asyncService.sendEmail("有内鬼，交易终止！！！");

        logger.info("AsyncController 异步请求结束");
        return "ok";
    }

    @GetMapping("/sendEmails")
    public @ResponseBody String sendEmails(){
        logger.info("AsyncController 获取异步请求");



        logger.info("AsyncController 异步请求结束");
        return "ok";
    }
}
